package com.mazaiting.uac.controller;

import com.mazaiting.common.core.ex.exceptions.BaseException;
import com.mazaiting.uac.domain.vo.SmsVO;
import com.mazaiting.uac.service.ISmsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 短信控制器
 *
 * @author mazaiting
 * @create_time 2022/9/28 14:11
 */
@Slf4j
@RestController
@RequestMapping("uac/v1/sms")
@RequiredArgsConstructor
public class SmsController {

    private final ISmsService smsService;

    /**
     * 发送登录验证码
     * @param t 时间
     * @param smsVO 短信实体
     * @return true: 发送成功; false: 发送失败
     */
    @PostMapping
    public boolean sendLoginCode(@RequestParam Long t, @Valid SmsVO smsVO) throws BaseException {
        return smsService.sendLoginCode(t, smsVO);
    }

}
